package DecoratorPattern;

import Model.Book;

// 逾期罚款装饰器
public class OverdueFineDecorator extends FineDecorator {
    private final double overdueFine;

    public OverdueFineDecorator(Book book, double overdueFine) {
        super(book);
        this.overdueFine = overdueFine;
    }

    @Override
    public double calculateFine() {
        // 基本罚款 + 逾期罚款
        return book.calculateFine() + overdueFine;
    }

    @Override
    public void displayInfo() {

        // 显示基本信息
        book.displayInfo();
        // 显示逾期罚款信息
        System.out.println("Overdue Fine: $" + overdueFine);
        // 显示总罚款信息
        System.out.println("Total Fine: $" + calculateFine());
    }

    }

